package world.snowcrystal.commons.model.vo;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import world.snowcrystal.commons.model.entity.DailyInvokeLog;

import java.io.Serial;
import java.io.Serializable;
import java.util.Date;

@Data
public class RecentInvokeCountVO implements Serializable {

    @Serial
    private static final long serialVersionUID = 1L;

    @JsonFormat(pattern = "yyyy-MM-dd")
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    private Date dateTime;

    private Long dailyInvokeCount;

    public static RecentInvokeCountVO fromEntity(DailyInvokeLog entity) {
        RecentInvokeCountVO vo = new RecentInvokeCountVO();
        vo.setDailyInvokeCount(entity.getDailyInvokeCount());
        vo.setDateTime(entity.getDateTime());
        return vo;
    }

}
